/*
  Copyright (C) 2011, Kyungjoo Kim
  
  This file is part of LINAL (LINear ALgebra)
  
  All rights reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  
  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  Also add information on how to contact you by electronic and paper mail.
  
  
  Kyungjoo Kim
  iamkyungjoo@gmail.com
*/
#ifndef LINAL_OPERATION_HIER_HXX
#define LINAL_OPERATION_HIER_HXX

namespace linal {

  extern int apply_pivots     ( int side, int trans, Hier_ piv, Hier_ A );

  extern int apply_q          ( int side, int trans, int direct, int storev,
                                Hier_ A, Hier_ T, Hier_ W, Hier_ B ); 
  extern int apply_q2         ( int side, int trans, int direct, int storev,
                                Hier_ D, Hier_ T, Hier_ W, Hier_ C, Hier_ E );
  extern int apply_q_inc      ( int side, int trans, int direct, int storev,
                                Hier_ A, Hier_ T, Hier_ W_1, Hier_ B );
     
  extern int chol_nopiv       ( int uplo, Hier_ A );
  extern int chol_incpiv      ( int uplo, Hier_ A, Hier_ p );

  extern int ldl_nopiv        ( int uplo, Hier_ A );
  extern int ldl_incpiv       ( int uplo, Hier_ A, Hier_ p );

  extern int lu_nopiv         ( Hier_ A );
  extern int lu_incpiv        ( Hier_ A, Hier_ p );
  extern int lu_piv           ( Hier_ A, Hier_ p );

  extern int qr               ( Hier_ A, Hier_ T ); 
  extern int qr2              ( Hier_ U, Hier_ D, Hier_ T ); 
  extern int qr_inc           ( Hier_ A, Hier_ T ); 

  extern int trmm             ( int side, int uplo, int trans, int diag,
                                FLA_Obj alpha, Hier_ A, Hier_ B );
  extern int trsm             ( int side, int uplo, int trans,
                                int diag, FLA_Obj alpha, Hier_ A, Hier_ B );
  extern int gemm             ( int trans, int transb, FLA_Obj alpha,
                                Hier_ A, Hier_ B, FLA_Obj beta, Hier_ C );
  extern int gemm_l           ( int trans, int transb, FLA_Obj alpha,
                                Hier_ A, Hier_ B, FLA_Obj beta, Hier_ C );
  extern int gemm_u           ( int trans, int transb, FLA_Obj alpha,
                                Hier_ A, Hier_ B, FLA_Obj beta, Hier_ C );
  extern int syrk             ( int uplo, int trans, FLA_Obj alpha, 
                                Hier_ A, FLA_Obj beta,  Hier_ C ); 
  extern int herk             ( int uplo, int trans, FLA_Obj alpha, 
                                Hier_ A, FLA_Obj beta,  Hier_ C ); 
  extern int scal             ( FLA_Obj alpha, Hier_ A );
    
}
#endif
